/* ========================================================================== */
/*   SoundController.h    	                                                  */
/*   (c) 2012 Team 7 Hogeschool Utrecht ICT TI                                */
/*		Lars Stolwijk, Gerben Boot, Guido van Hienen, Marcel Boelen			  */
/*                                                                            */
/*   Receives sound	commands and translates these commands to proper		  */
/*		Hertz and Seconds for the Beeper							          */
/* ========================================================================== */

#ifndef __SoundController
#define __SoundController

#include "pRTOS.h"
#include "Beeper.h"
#include "Health.h"

class Beeper;
class Health;

class SoundController : public RTOS::task {
	public:			
		//Constructor
		SoundController(int prio, Beeper * beeper) : RTOS::task(prio, "SoundControllerTask"), theBeeper(beeper), SCTTimer(this, "SCTTimer"), PlayIntroduceGameSoundFlag(this, "PlayIntroduceGameSoundFlag"), PlayStartGameSoundFlag(this, "PlayStartGameSoundFlag"), PlayEndGameSoundFlag(this, "PlayEndGameSoundFlag"), PlayDeathSoundFlag(this, "PlayDeathSoundFlag"), PlayActivateDeactivatePlayerSoundFlag(this, "PlayActivateDeactivatePlayerSoundFlag"), PlayHitSoundFlag(this, "PlayHitSoundFlag"), PlayReadLogSoundFlag(this, "PlayReadLogSoundFlag"){}
		
		void PlayIntroduceGameSound();
		void PlayStartGameSound();
		void PlayEndGameSound();
		void PlayDeathSound();
		void PlayActivateDeactivatePlayerSound();
		void PlayHitSound();
		void PlayReadLogSound();
		void RegisterHealth(Health * health);
	
	private:
		enum State { RUNNING, PLAYINGSTARTSOUND,PLAYINGHEALTHSOUND };
		State CurrentState;

		Beeper * theBeeper;
		Health * theHealth;
		RTOS::timer SCTTimer;
		
		//Flags
		RTOS::flag PlayIntroduceGameSoundFlag, PlayStartGameSoundFlag, PlayEndGameSoundFlag, PlayDeathSoundFlag, PlayActivateDeactivatePlayerSoundFlag, PlayHitSoundFlag, PlayReadLogSoundFlag;
		
		void main();
};

#endif
